<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../lib/vue.js"></script>
  <script src="../lib/vue-route.js"></script>
  <style>
      .header {
        background-color: orange;
        height: 80px;
      }

      h2 {
          margin: 0;
          padding: 0;
      }

      .container {
           display: flex;
           height: 400px;
      }

      .left {
          background-color: lightgreen;
          flex: 2;
      }

      .main {
          background-color: lightpink;
          flex: 8;
      }
  </style>
</head>

<body>
  <div id="app">
    <router-view></router-view>
    <div class="container">
        <router-view name="left"></router-view>
        <router-view name="main"></router-view>
    </div>
  </div>
  <script>
    var header = {
      template: '<h2 class="header">Header头部区域</h2>'
    }

    var leftBox = {
        template: '<h2 class="left">leftBox侧边栏区域</h2>'
    }

    var mainBox = {
        template: '<h2 class="main">mainBox主体区域</h2>'
    }

    // 创建路由对象
    var router = new VueRouter({
        routes: [{
            path: '/',
            components: {
                'default': header,
                'left': leftBox,
                'main': mainBox
            }
        }]
    })


    // 创建Vue实例，得到ViewModel
    var vm = new Vue({
      el: '#app',
      data: {},
      methods: {},
      router
    });
  </script>
</body>

</html>